1,7,14,21,26 * */bin/find-name "core"-exec rm {} \;Now save and exit. It's a good idea to add a comment above each entry in the crontab file so that you know its function, uptime, and more importantly, who knows which user's job.Now let's list all of its information using the CRONTAB-L command we talked about earlier:Copy code code as follows:$
similar to the above. You can use this method to make a backup of the crontab file in the H O M e directory:$ crontab-l > $HOME/mycronThis way, once the crontab file is accidentally deleted, it can be recovered quickly using the method described in the previous section.3). Edit the Crontab fileIf you want to add, dele
. Brilliant ~~Next I will try to summarize the basic usage of crontab, environment variables, and other issues to be aware. If you have any questions, you can leave a message to discuss them.----------------------------1. Basic crontab usageUsage: crontab [-u user] [-E |-L |-R]The crontab format is described as follows
Cron mechanism
Cron allows the system to perform a specified work at a specified time, and we can use the CRONTAB directive to manage the cron mechanism
Crontab parameters
-U: This parameter allows us to edit other people's crontab, if not add this parameter, will open their own crontab
quickly using the method described in the previous section.3). Edit the Crontab fileIf you want to add, delete, or edit an entry in the Crontab file, and the E D I to r environment variable is set to V I, then you can edit the crontab file with V I, and the corresponding command is:$ crontab-eYou can modify the
. You can use this method to back up the crontab file in the $ h o m e directory:
$ Crontab-l> $ HOME/mycron
In this way, once the crontab file is accidentally deleted, you can use the method described in the previous section to quickly restore it.
3). Edit the crontab file
If you want TO add, delete, or edit e
range, it will prompt you. When we edit the crontab file, we may not be adding a new entry. For example, add the following article: # Dt:delete core Files,at3.30am on1,7, -, +, -, -Days of each month - 3 1,7, -, +, -* */bin/Find-name"Core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its
integrity checks on the file when you save it. If one of the fields has a value that is outside the allowable range, it prompts you.
When we edit the crontab file, we may add a new entry. For example, add the following article:
# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month
3 1,7,14,21,26 * */bin/find-name "core"-exec rm {} \;
Now save and exit. It's a good idea to add a comment
daysofeachmonth
3031,7, 14,21, 26 **/bin/find-name "core'-execrm {}\;
Save and exit now. It is best to add a comment to each entry in the crontab file so that you can know its function and running time. More importantly, you can know which user's job this is.
Now let's use the previous crontab-l command to list all its information:
$
adding a new entry. For example, add one of the following:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous
new entry. For example, add one of the following:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous
section.3). Edit the Crontab fileIf you want to add, delete, or edit an entry in the Crontab file, and the E D I to r environment variable is set to V I, then you can edit the crontab file with V I, and the corresponding command is:$ crontab-eYou can modify the Crontab file
. For example, add one of the following:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous cronta
entry. For example, add one of the following:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous
. For example, add one of the following:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous cronta
using the method described in the previous section.3). Edit the Crontab fileIf you want to add, delete, or edit an entry in the Crontab file, and the E D I to r environment variable is set to V I, then you can edit the crontab file with V I, and the corresponding command is:$ crontab-eYou can modify the
the crontab file, we may add a new entry. For example, add the following article:# Dt:delete Core Files,at 3.30am on 1,7,14,21,26,26 days of each month3 1,7,14,21,26 * */bin/find-name "core"-exec rm {} \;Now save and exit. It's a good idea to add a comment above each entry in the crontab file so that you know its function, uptime, and more importantly, who knows
1,7,14,21,26 /bin/find-name "Core '-exec rm {} \;Save and exit now. It is best to add a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous crontab-l command to list all of its information:$ crontab-l# (Cron
similar to the above. You can use this method to make a backup of the crontab file in the H O M e directory:$ crontab-l > $HOME/mycronThis way, once the crontab file is accidentally deleted, it can be recovered quickly using the method described in the previous section.3). Edit the Crontab fileIf you want to add, dele
a comment above each entry in the crontab file, so that you can know its function, run time, and, more importantly, what user's job it is.Now let's use the previous crontab-l command to list all of its information:$ crontab-l# (crondave installed on Tue May 4 13:07:43 1999)# DT:ech the date to the console every 30 min
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.